package org.nepu.scr.indexrate.converter.drillingrate.jobsupport;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.jobsupport.EvacuationInput;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class EvacuationInputConverter implements AttributeConverter<EvacuationInput, String> {
    @Override
    public String convertToDatabaseColumn(EvacuationInput evacuationInput) {
        return JSONUtil.toJsonStr(evacuationInput);
    }

    @Override
    public EvacuationInput convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, EvacuationInput.class);
    }
}
